home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / earcd / biz / dbase / db3_4src.lha / db3.4 / WaitPointer.c < prev    next >
C/C++ Source or Header  |  1994-11-20  |  2KB  |  80 lines

  1. /* WaitPointer.c Two routines to block input on a window */
  2. /* Will use a hires waitpointer on v39+ and a lo-res "clock" in pre v39 */
  3. /* Currently only allows only one invocation at a time */
  4. /* If a a function is called twice in a row, the 2:nd call will be ignored */
  5.  
  6. #include <exec/types.h>
  7. #include <exec/libraries.h>
  8. #include <intuition/intuition.h>
  9. #include <intuition/intuitionbase.h>
  10. #include <proto/exec.h>
  11. #include <proto/intuition.h>
  12.  
  13. extern struct IntuitionBase *IntuitionBase;
  14.  
  15. /* our function prototypes */
  16. BOOL BlockInput(struct Window *Win, BOOL Delay);
  17. void FreeInput(struct Window *Win);
  18.  
  19. /* Data */
  20. static struct Requester MyReq;
  21. static struct Window *RememberWin = NULL;
  22.  
  23. /* data for a busy pointer.
  24. ** this data must be in chip memory!!!
  25. */
  26. static UWORD __chip waitPointer[] =
  27.     {
  28.     0x0000, 0x0000,     /* reserved, must be NULL */
  29.  
  30.     0x0400, 0x07C0,
  31.     0x0000, 0x07C0,
  32.     0x0100, 0x0380,
  33.     0x0000, 0x07E0,
  34.     0x07C0, 0x1FF8,
  35.     0x1FF0, 0x3FEC,
  36.     0x3FF8, 0x7FDE,
  37.     0x3FF8, 0x7FBE,
  38.     0x7FFC, 0xFF7F,
  39.     0x7EFC, 0xFFFF,
  40.     0x7FFC, 0xFFFF,
  41.     0x3FF8, 0x7FFE,
  42.     0x3FF8, 0x7FFE,
  43.     0x1FF0, 0x3FFC,
  44.     0x07C0, 0x1FF8,
  45.     0x0000, 0x07E0,
  46.  
  47.     0x0000, 0x0000,     /* reserved, must be NULL */
  48.     };
  49.  
  50. BOOL IsInputBlocked(void)
  51. {
  52.     return (BOOL)RememberWin;
  53. }
  54.  
  55. BOOL BlockInput(struct Window *Win, BOOL Delay)
  56. {
  57.     if (RememberWin) return TRUE;    /* Already blocked */
  58.     RememberWin = Win;
  59.  
  60.     InitRequester(&MyReq);
  61.     if (Request(&MyReq, Win)) {
  62.         if (IntuitionBase->LibNode.lib_Version >= 39) SetWindowPointer(
  63.             Win, WA_BusyPointer, TRUE, WA_PointerDelay, Delay, TAG_DONE);
  64.         else SetPointer(Win, waitPointer, 16, 16, -6, 0);
  65.     
  66.         return TRUE;
  67.     }
  68.     else return FALSE;
  69. }
  70.  
  71.  
  72. void FreeInput(struct Window *Win)
  73. {
  74.     if (!RememberWin) return;
  75.     RememberWin = NULL;
  76.  
  77.     if (IntuitionBase->LibNode.lib_Version >= 39) SetWindowPointer(Win,TAG_DONE);
  78.     else ClearPointer(Win);
  79.     EndRequest(&MyReq, Win);
  80. }